import javax.swing.JTextField;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.Font;
import java.awt.Color;
public class TapeTextField extends JTextField implements KeyListener
  {
  private static final int fontSize=14;
  private Machine machine;
  private boolean go;
  public TapeTextField(Machine machine)
    {
    super();
    this.machine=machine;
    go=false;
    addKeyListener(this);
    Font font = new Font("monospaced", Font.PLAIN, fontSize);
    setFont(font);
    setForeground(Color.BLUE);
    }
  public void keyPressed(KeyEvent e)
    {
    if(e.getKeyCode()==10)
      {
      machine.step();
      }
    }
  public void keyReleased(KeyEvent e)
    {
    }
  public void keyTyped(KeyEvent e)
    {
    }
  }
